package com.springcloud3;

import com.springcloud3.config.Person;
import com.springcloud3.config.Pig;
import com.springcloud3.config.Sheep;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

@SpringBootApplication
/**
 * 1.开启sheep组件绑定
 * 2.默认把这个主键放到容器中
 * 3.导入第三方包
 */
@EnableConfigurationProperties(Sheep.class)
public class Springcloud3Application {

    public static void main(String[] args) {

//java 10: 局部变量类型的自动推断
        var ioc=SpringApplication.run(Springcloud3Application.class, args);
  //1.获取容器中所有组件的名字
//        String[] names=ioc.getBeanDefinitionNames();
//        for (String name:
//             names) {
//            System.out.println(name);
//
//        }
   //  Pig pig =ioc.getBean(Pig.class);
  //   System.out.println("pig "+pig);

       // Sheep sheep =ioc.getBean(Sheep.class);
      //  System.out.println("sheep "+sheep);
        Person person =ioc.getBean(Person.class);
         System.out.println("person "+person);
    }

}
